﻿using Core.Base.Module;
using Core.Base.UI;
using Core.Extension;
using Logic.Global;
using UnityEngine.UI;

namespace Logic.Fight.UI
{
    /// <summary>
    /// 战斗UI
    /// </summary>
    [UI("FightUI", EUIType.BaseCanvas, false, EScreenMatchMode.Height)]
    public class FightUI : BaseUI
    {
        public Button btnBackHome;
        public Button btnRestart;

        public override void OnInit(UIAttribute uiAttribute)
        {
            base.OnInit(uiAttribute);
            btnBackHome.BindEvent(OnClickBtnBackHome);
            btnRestart.BindEvent(OnClickBtnRestart);
        }

        /// <summary>
        /// 当点击重新开始
        /// </summary>
        private void OnClickBtnRestart()
        {
            ModuleMgr.Ins.ReloadCurModule();
        }

        /// <summary>
        /// 当点击返回首页
        /// </summary>
        private void OnClickBtnBackHome()
        {
            OnClose();
            ModuleMgr.Ins.LoadModule<MainModule>();
        }
    }
}